package com.baidu.aip.client;

import com.baidu.aip.nlp.AipNlp;
import org.json.JSONObject;

/** 百度AI开放平台客户端测试
 * @author Jiayuan
 * @version 1.0
 * @description:
 * @time 11/16/2018 3:05 PM
 */
public class Sample {

    public static final String APP_ID = "14829520";
    public static final String API_KEY = "rGwimiwf7pO1xw1YfGQTm9Y3";
    public static final String SECRET_KEY = "spgzElGA0huZUAe0U8DVqBxyBrxPGgTg";


    public static void main(String[] args) {
        //初始化一个AipNlp
        AipNlp client = GetClient.getClient(APP_ID,API_KEY,SECRET_KEY);
        //可选，设置网络参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);

        //可选：设置网络连接参数
        //client.setHttpProxy("proxy_host",proxy_port);
        //client.setSocketProxy("proxy_host",proxy_port);

        //可选：设置log4j日志输出格式，若不设置，则使用默认配置
        //System.setProperties("aip.log.conf","path/to/your/log4j.proprties");

        //调用接口
        String text = "百度是一家高科技公司";
        JSONObject res = client.lexer(text,null);
        System.out.println(res.toString());
    }
}
